﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ImportFromExcel.ascx.vb"
	Inherits="Control_Customer_ImportFromExcel" %>
<style type="text/css">
	.RowError
	{
		color: blue;
		background-color: yellow;
	}
	.CellsError
	{
		background-color: red;
		}
</style>
<script type='text/javascript'>
	function ajaxJquery() {
		$(function () {
			$(".Date").datepicker({ dateFormat: 'yy/mm/dd', maxDate: new Date, minDate: new Date(1900, 1, 1) });
		});
	}

	function ComfirmDialog(strText, value, ObjectIdClick, ID, Type) {
		if (value == 0) {
			Confirmbox(strText, value, ObjectIdClick, ID, Type);
			return false;
		} else {
			if (Type == 1) {
				eval($("#" + ObjectIdClick + "").attr("href"));
			}
			else {
				$("#" + ObjectIdClick + "").click();
			}
		}
	}

	// FUnction check valid 
	function CheckValid() {
		var _result = true;
		var _txtDate = $("#<%= txtUpdateDate.ClientID %>").val().trim();
		var _hasFile = $("#<%= flDocument.ClientID %>").val().trim();
		if (_txtDate == "") {
			_result = false;
			Alertbox('Hãy chọn ngày trước');
		} else if (_hasFile == 0) {
			_result = false;
			Alertbox('Hãy chọn 1 file [*.xls | xlsx]');
		}
		if (_result) {
			$("#hidUpdateDate").val(_txtDate);
		}
		return _result;
	}

</script>
<asp:UpdatePanel ID="uplImportFromExcelssss" runat="server">
	<ContentTemplate>
		<div class="BoxField">
			<div class="Header">
				<h3>
					IMPORT DATA FROM EXCEL FILE</h3>
			</div>
			<div class="Required">
				<span class="fieldRequired">&nbsp;</span>Trường yêu cầu nhập dữ liệu
				<br />
				<span class="fieldRequired">&nbsp;</span>Note: Định dạng file upload excel (.xls
				| xlsx) (file mẫu: <asp:HyperLink ID="hplTemplate" runat="server">tải về</asp:HyperLink>)
			</div>
			<div class="Error">
			</div>
			<div class="DivRow">
				<div class="DivLabel">
					<asp:Label ID="lblChooseFile" CssClass="TextLabel" runat="server" Text="Chọn ngày cập nhật:" /><span
						class="fieldRequired">&nbsp;</span>
				</div>
				<div class="DivTextBox">
					<asp:TextBox ID="txtUpdateDate" runat="server" CssClass="Date TextBox" />
				</div>
			</div>
			<div class="DivRow">
				<div class="DivLabel">
					<asp:Label ID="lblFullname" CssClass="TextLabel" runat="server" Text="File cập nhật:" /><span
						class="fieldRequired">&nbsp;</span>
				</div>
				<div class="DivTextBox">
					<asp:FileUpload ID="flDocument" runat="server" />
					<%--<input id="file_upload_content" name="file_upload_content" type="file" />--%>
				</div>
			</div>
			<div style="clear: both; height: 10px">
			</div>
			<div id="divInformation" runat="server">
				<div class="DivRow">
					<asp:Label ID="lblMessage" runat="server" Text="" />
				</div>
				<div class="DivRow">
					<asp:Label ID="lblError" runat="server" Text="" /><br />
					<asp:TextBox ID="txtErrorLog" runat="server" TextMode="MultiLine" Rows="10" CssClass="textarea1"
						Width="946px" Text="" />
				</div>
			</div>
			<div class="DivRow">
				<div class="DivLabel">
					&nbsp;&nbsp;&nbsp;
				</div>
				<div class="DivTextBox">
					<asp:Button ID="btnUpload" runat="server" CssClass="btn" Text=" Upload " OnClientClick="return CheckValid();" />
					<asp:Button ID="btnSubmitChange" runat="server" Text="Cập nhật " CssClass="btn" Enabled="false" />
				</div>
			</div>
			<div class="DivRow">
				DANH SÁCH CÁC KHÁCH LƯU TRÚ SẼ ĐƯỢC IMPORT
			</div>
			<div class="DivRow" style="overflow-x: auto;">
				<div style="width: 1980px">
					<%--<asp:GridView runat="server" ID="grvDanhSach" AutoGenerateColumns="False" EmptyDataText="{Không có dữ liệu}"
						AllowPaging="false" Width='1540px' BorderWidth="1px" CssClass="GridBorder">
						<Columns>
							<asp:TemplateField HeaderText="STT">
								<ItemTemplate>
									<%# Container.DataItemIndex +1 %>
								</ItemTemplate>
								<HeaderStyle Width="2%" HorizontalAlign="Left" />
							</asp:TemplateField>
							<asp:BoundField DataField='FullName' HeaderText='Họ tên ' ItemStyle-Width="8%" />
							<asp:BoundField DataField='Sex' HeaderText='Giới tính' ItemStyle-Width="2%" />
							<asp:BoundField DataField='DateOfBirth' HeaderText='Ngày sinh' DataFormatString="{0:yyyy/MM/dd}"
								ItemStyle-Width="5%" />
							<asp:BoundField DataField='DateOfBirthType' HeaderText='XD ngày sinh' ItemStyle-Width="5%"
								DataFormatString="{0:yyyy/MM/dd}" />
							<asp:BoundField DataField='CountryCode' HeaderText='Quốc tịch' ItemStyle-Width="5%" />
							<asp:BoundField DataField='PasspostNumber' HeaderText='Số hộ chiếu' ItemStyle-Width="6%" />
							<asp:BoundField DataField='PasspostType' HeaderText='Loại hộ chiếu' ItemStyle-Width="6%" />
							<asp:BoundField DataField='SoThiThuc' HeaderText='Số TT' ItemStyle-Width="8%" />
							<asp:BoundField DataField='LoaiThiThuc' HeaderText='Loại TT' ItemStyle-Width="5%" />
							<asp:BoundField DataField='ThoiHanThiThuc' HeaderText='Thời hạn TT' DataFormatString="{0:yyyy/MM/dd}"
								ItemStyle-Width="5%" />
							<asp:BoundField DataField='NgayCapThiThuc' HeaderText='Ngày cấp TT' DataFormatString="{0:yyyy/MM/dd}"
								ItemStyle-Width="5%" />
							<asp:BoundField DataField='CoQuanCapThiThuc' HeaderText='Cơ quan cấp TT' ItemStyle-Width="5%" />
							<asp:BoundField DataField='EntryDate' HeaderText='Ngày NC' DataFormatString="{0:yyyy/MM/dd}"
								ItemStyle-Width="5%" />
							<asp:BoundField DataField='GateCode' HeaderText='Cửa khẩu NC' ItemStyle-Width="3%" />
							<asp:BoundField DataField='EntryPurposeCode' HeaderText='Mục đích NC' ItemStyle-Width="3%" />
							<asp:BoundField DataField='FromDate' HeaderText='Tạm trú từ' DataFormatString="{0:yyyy/MM/dd}"
								ItemStyle-Width="5%" />
							<asp:BoundField DataField='ToDate' HeaderText='Tạm trú đến' DataFormatString="{0:yyyy/MM/dd}"
								ItemStyle-Width="5%" />
							<asp:BoundField DataField='PrintedDate' HeaderText='Ngày Checkout' DataFormatString="{0:yyyy/MM/dd}" />
							<asp:BoundField DataField='HotelId' HeaderText='Mã CSLT' ItemStyle-Width="3%" />
							<asp:BoundField DataField='OtherNote' HeaderText='Ghi chú' ItemStyle-Width="5%" />
						</Columns>
						<HeaderStyle Height="26px" HorizontalAlign="Center" CssClass="GridHeader" />
						<RowStyle CssClass="GridRow" Height="23px" />
						<AlternatingRowStyle CssClass="GridAlterRow" />
						<PagerStyle CssClass="GridPaged" HorizontalAlign="Right" Height="23px" />
						<PagerSettings Mode="Numeric" PageButtonCount="2" />
						<EmptyDataRowStyle CssClass="GridTextEmpty" HorizontalAlign="Center" />
					</asp:GridView>--%>
					<table width="100%" border="1" bordercolor="#000000" style="font-family: Tahoma;
						border-collapse: collapse;">
						<tr style="font-weight: bold; font-size: 10pt; padding-left: 1pt; padding-right: 1pt;
							font-family: Tahoma;">
							<td width="4%" align="center">
								STT
							</td>
							<td width="13%" align="center">
								Họ tên
							</td>
							<td width="6%" align="center">
								Giới tính
							</td>
							<td width="8%" align="center">
								Sinh
								<br />
								Ngày,tháng, năm
							</td>
							<td width="7%" align="center">
								Quốc tịch
							</td>
							<td width="10%" align="center">
								Loại
								<br />
								số hộ chiếu
							</td>
							<td width="19%" align="center">
								Loại, thời hạn, số, ngày cấp, cơ quan cấp thị thực
							</td>
							<td width="10%" align="center">
								Ngày, cửa khẩu nhập cảnh
							</td>
							<td width="10%" align="center">
								Mục đích nhập cảnh
							</td>
							<td width="*" align="center">
								Tạm trú
								<br />
								(từ ngày đến ngày)
							</td>
						</tr>
						<asp:Repeater ID="rptPrintedList" runat="server">
							<ItemTemplate>
								<tr style="font-weight: none; font-size: 10pt; padding-left: 1pt; padding-right: 1pt;
									font-family: Tahoma;" class='<%# Me.RowClassError(DataBinder.Eval(Container.DataItem, "ErrorRow").ToString()) %>'>
									<td align="right" valign="top" style="padding-right: 3pt; padding-left: 3pt" >
										<%--<span tal:content="python: repeat['re'].number()"/> --%>
										<asp:Label ID="lblStt" runat="server"></asp:Label>
									</td>
									<td align="left" valign="top" style="padding-right: 3pt; padding-left: 3pt; text-transform: uppercase">
										<asp:Label ID="lblFullName" runat="server"></asp:Label>
									</td>
									<td align="left" valign="top" style="padding-right: 3pt; padding-left: 3pt">
										<%--tal:define="Sex result/Sex | nothing" tal:content="python: test(Sex=='M','Nam', test(Sex=='F', 'Nữ', ''))"--%>
										<asp:Label ID="lblSex" runat="server"></asp:Label>
									</td>
									<td align="center" valign="top" style="padding-right: 3pt; padding-left: 3pt"  class='<%# Me.CellClassError("4",DataBinder.Eval(Container.DataItem, "ErrorRow").ToString()) %>'>
										<%--tal:content="python: result.DateOfBirth and  result.DateOfBirth or ''"--%>
										<asp:Label ID="lblDateOfBirth" runat="server"></asp:Label>
									</td>
									<td align="left" valign="top" style="padding-right: 3pt; padding-left: 3pt">
										<%--            tal:define="Nationality result/Nationality | nothing;
                        lstNationality here/portal_properties/site_properties/QuocGia;"
             tal:content="python: context.getValueFromList(key=Nationality, list=lstNationality)"> --%>
										<asp:Label ID="lblCountryName" runat="server"></asp:Label>
									</td>
									<td align="left" valign="top" style="padding-right: 3pt; padding-left: 3pt;" class='<%# Me.CellClassError("6",DataBinder.Eval(Container.DataItem, "ErrorRow").ToString()) %>'>
										<%-- tal:content="result/Occupation | nothing"> --%>
										<asp:Label ID="lblSoLoaiHoChieu" runat="server"></asp:Label>
									</td>
									<td align="left" valign="top" style="padding-right: 3pt; padding-left: 3pt; text-transform: uppercase" class='<%# Me.CellClassError("7",DataBinder.Eval(Container.DataItem, "ErrorRow").ToString()) %>'>
										<%-- tal:content="result/PassportNumber | nothing"> --%>
										<asp:Label ID="lblThiThuc" runat="server"></asp:Label>
									</td>
									<td align="center" valign="top" style="padding-right: 3pt; padding-left: 3pt" class='<%# Me.CellClassError("8",DataBinder.Eval(Container.DataItem, "ErrorRow").ToString()) %>'>
										<%-- tal:content="python: result.ExpireDate and result.ExpireDate or ''"> --%>
										<asp:Label ID="lblNgayNhapCanh" runat="server"></asp:Label>,
										<asp:Label ID="lblCuaKhauNhapCanh" runat="server"></asp:Label>
									</td>
									<td align="center" valign="top" style="padding-right: 3pt; padding-left: 3pt" class='<%# Me.CellClassError("9",DataBinder.Eval(Container.DataItem, "ErrorRow").ToString()) %>'>
										<%-- tal:content="python: result.ToDate and result.ToDate or ''"> --%>
										<asp:Label ID="lblMucDichNhapCanh" runat="server"></asp:Label>
									</td>
									<td align="left" valign="top" style="padding-right: 3pt; padding-left: 3pt" class='<%# Me.CellClassError("10",DataBinder.Eval(Container.DataItem, "ErrorRow").ToString()) %>'>
										<%-- tal:content="result/GreetingOrganization | nothing" > --%>
										<asp:Label ID="lblFromDate" runat="server"></asp:Label>
										-
										<asp:Label ID="lblToDate" runat="server"></asp:Label>
									</td>
								</tr>
							</ItemTemplate>
						</asp:Repeater>
					</table>
				</div>
			</div>
			<div style="display: none">
				<asp:HiddenField runat="server" ID="hidhotelID" Value="" ClientIDMode="Static" />
				<asp:HiddenField runat="server" ID="hidUpdateDate" Value="" ClientIDMode="Static" />
			</div>
		</div>

    <div style="display:none">
        <asp:HyperLink ID="btnThongBao" runat="server" CssClass="thickbox" Text ="ThongBao">
    
        </asp:HyperLink>
    </div>


        <script type="text/javascript">
            $(function () {
                if ($("#<%=btnThongBao.ClientID %>").text() == 'ThongBao') {
                    $("#<%=btnThongBao.ClientID %>").click();
                    return false;
                }
            });
        </script>



	</ContentTemplate>
	<Triggers>
		<asp:PostBackTrigger ControlID="btnUpload" />
	</Triggers>


</asp:UpdatePanel>
